home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
224_01
/
tr.hlp
< prev
next >
Wrap
Text File
|
1987-01-04
|
2KB
|
39 lines
NAME
tr - translate characters
SYNTAX
tr [ -cds ] string1 [ string2 ]
DESCRIPTION
Tr copies the standard input to the standard output with substitution or
deletion of selected characters. Input characters found in string1 are
mapped into the corresponding characters of string2. When string2 is short
it is padded to the length of string1 by duplicating its last character.
Any combination of the options -cds may be used:
-c complements the set of characters in string1 with respect to the
universe of characters whose ASCII codes are 01 through 0377 octal
-d deletes all input characters in string1
-s squeezes all strings of repeated output characters that are in
string2 to single characters.
In either string the notation a-b means a range of characters from a to b
in increasing ASCII order. The character '\' followed by 1, 2 or 3 octal
digits stands for the character whose ASCII code is given by those digits.
A '\' followed by b, n, r, f, t, s stand for the ASCII character BS, LF,
CR, HT, SP. A '\' followed by any other character stands for that
character.
EXAMPLE
The following example creates a list of all the words in 'file1' one per
line in 'file2', where a word is taken to be a string of alphabetics.
tr -cs A-Za-z \n <file1 >file2
RESTRICTIONS
Tr deletes all ASCII NUL characters from the input. A '\000' specified
in string1 or string2 is translated to mean '\001'.